home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48hor2
/
apply.doc
< prev
next >
Wrap
Text File
|
1995-03-31
|
661b
|
24 lines
Author: [William C Wickes]
Date: Thu Apr 11 1991
Given x and F on the stack, where x is any argument, and F is a
function of one argument (user-defined or built-in), the following
program returns 'F(x)':
%%HP: T(3)A(R)F(.);
@ x F -> 'F(x)'
\<< SWAP -> a
\<< 'a' SWAP EVAL @ 'F(a)'
'a' a 2 \->LIST \|^MATCH DROP @ 'F(x)'
\>>
\>>
To put a built-in function F on the stack, execute { F } 1 GET. You
can also build this logic into the program above, and use { F } as the
argument.
For user-defined functions, you also can use SWAP 1 \->LIST SWAP APPLY.
Bill Wickes
HP Corvallis